package com.whc.controller;

import com.whc.service.UserService;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wang-hai-cheng
 * @since 2021/12/11 13:02
 */
@RestController
@AllArgsConstructor
public class LoginController {
    UserService userService;

    @RequestMapping("login")
    public ResponseEntity<?> login(String username, String password) {
        return ResponseEntity.ok(userService.login(username, password));
    }

    @RequestMapping("refresh")
    public ResponseEntity<?> refresh(String token) {
        return ResponseEntity.ok(userService.refresh(token));
    }
}